3.4.23 \(\int \frac {\sec ^4(x)}{(a+b \sin ^2(x))^2} \, dx\) [323]

3.4.23.1 Optimal result
3.4.23.2 Mathematica [A] (verified)
3.4.23.3 Rubi [A] (verified)
3.4.23.4 Maple [A] (verified)
3.4.23.5 Fricas [B] (verification not implemented)
3.4.23.6 Sympy [F]
3.4.23.7 Maxima [B] (verification not implemented)
3.4.23.8 Giac [B] (verification not implemented)
3.4.23.9 Mupad [B] (verification not implemented)

3.4.23.1 Optimal result

Integrand size = 15, antiderivative size = 96 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\frac {b^2 (6 a+b) \arctan \left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{7/2}}+\frac {(a+3 b) \tan (x)}{(a+b)^3}+\frac {\tan ^3(x)}{3 (a+b)^2}+\frac {b^3 \tan (x)}{2 a (a+b)^3 \left (a+(a+b) \tan ^2(x)\right )} \]

output
1/2*b^2*(6*a+b)*arctan((a+b)^(1/2)*tan(x)/a^(1/2))/a^(3/2)/(a+b)^(7/2)+(a+ 
3*b)*tan(x)/(a+b)^3+1/3*tan(x)^3/(a+b)^2+1/2*b^3*tan(x)/a/(a+b)^3/(a+(a+b) 
*tan(x)^2)
 
3.4.23.2 Mathematica [A] (verified)

Time = 0.98 (sec) , antiderivative size = 97, normalized size of antiderivative = 1.01 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\frac {1}{6} \left (\frac {3 b^2 (6 a+b) \arctan \left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{a^{3/2} (a+b)^{7/2}}+\frac {\frac {3 b^3 \sin (2 x)}{a (2 a+b-b \cos (2 x))}+4 a \tan (x)+16 b \tan (x)+2 (a+b) \sec ^2(x) \tan (x)}{(a+b)^3}\right ) \]

input
Integrate[Sec[x]^4/(a + b*Sin[x]^2)^2,x]
 
output
((3*b^2*(6*a + b)*ArcTan[(Sqrt[a + b]*Tan[x])/Sqrt[a]])/(a^(3/2)*(a + b)^( 
7/2)) + ((3*b^3*Sin[2*x])/(a*(2*a + b - b*Cos[2*x])) + 4*a*Tan[x] + 16*b*T 
an[x] + 2*(a + b)*Sec[x]^2*Tan[x])/(a + b)^3)/6
 
3.4.23.3 Rubi [A] (verified)

Time = 0.32 (sec) , antiderivative size = 96, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.267, Rules used = {3042, 3670, 300, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx\)

\(\Big \downarrow \) 3042

\(\displaystyle \int \frac {1}{\cos (x)^4 \left (a+b \sin (x)^2\right )^2}dx\)

\(\Big \downarrow \) 3670

\(\displaystyle \int \frac {\left (\tan ^2(x)+1\right )^3}{\left ((a+b) \tan ^2(x)+a\right )^2}d\tan (x)\)

\(\Big \downarrow \) 300

\(\displaystyle \int \left (\frac {3 b^2 (a+b) \tan ^2(x)+b^2 (3 a+b)}{(a+b)^3 \left ((a+b) \tan ^2(x)+a\right )^2}+\frac {\tan ^2(x)}{(a+b)^2}+\frac {a+3 b}{(a+b)^3}\right )d\tan (x)\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {b^2 (6 a+b) \arctan \left (\frac {\sqrt {a+b} \tan (x)}{\sqrt {a}}\right )}{2 a^{3/2} (a+b)^{7/2}}+\frac {b^3 \tan (x)}{2 a (a+b)^3 \left ((a+b) \tan ^2(x)+a\right )}+\frac {\tan ^3(x)}{3 (a+b)^2}+\frac {(a+3 b) \tan (x)}{(a+b)^3}\)

input
Int[Sec[x]^4/(a + b*Sin[x]^2)^2,x]
 
output
(b^2*(6*a + b)*ArcTan[(Sqrt[a + b]*Tan[x])/Sqrt[a]])/(2*a^(3/2)*(a + b)^(7 
/2)) + ((a + 3*b)*Tan[x])/(a + b)^3 + Tan[x]^3/(3*(a + b)^2) + (b^3*Tan[x] 
)/(2*a*(a + b)^3*(a + (a + b)*Tan[x]^2))
 

3.4.23.3.1 Defintions of rubi rules used

rule 300
Int[((a_) + (b_.)*(x_)^2)^(p_)*((c_) + (d_.)*(x_)^2)^(q_), x_Symbol] :> Int 
[PolynomialDivide[(a + b*x^2)^p, (c + d*x^2)^(-q), x], x] /; FreeQ[{a, b, c 
, d}, x] && NeQ[b*c - a*d, 0] && IGtQ[p, 0] && ILtQ[q, 0] && GeQ[p, -q]
 

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 3042
Int[u_, x_Symbol] :> Int[DeactivateTrig[u, x], x] /; FunctionOfTrigOfLinear 
Q[u, x]
 

rule 3670
Int[cos[(e_.) + (f_.)*(x_)]^(m_)*((a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]^2)^( 
p_.), x_Symbol] :> With[{ff = FreeFactors[Tan[e + f*x], x]}, Simp[ff/f   Su 
bst[Int[(a + (a + b)*ff^2*x^2)^p/(1 + ff^2*x^2)^(m/2 + p + 1), x], x, Tan[e 
 + f*x]/ff], x]] /; FreeQ[{a, b, e, f}, x] && IntegerQ[m/2] && IntegerQ[p]
 
3.4.23.4 Maple [A] (verified)

Time = 1.65 (sec) , antiderivative size = 110, normalized size of antiderivative = 1.15

method result size
default \(\frac {\frac {a \left (\tan ^{3}\left (x \right )\right )}{3}+\frac {b \left (\tan ^{3}\left (x \right )\right )}{3}+\tan \left (x \right ) a +3 \tan \left (x \right ) b}{\left (a^{2}+2 a b +b^{2}\right ) \left (a +b \right )}+\frac {b^{2} \left (\frac {b \tan \left (x \right )}{2 a \left (a \left (\tan ^{2}\left (x \right )\right )+\left (\tan ^{2}\left (x \right )\right ) b +a \right )}+\frac {\left (6 a +b \right ) \arctan \left (\frac {\left (a +b \right ) \tan \left (x \right )}{\sqrt {a \left (a +b \right )}}\right )}{2 a \sqrt {a \left (a +b \right )}}\right )}{\left (a +b \right )^{3}}\) \(110\)
risch \(\frac {i \left (-18 a \,b^{2} {\mathrm e}^{8 i x}-3 b^{3} {\mathrm e}^{8 i x}+36 a^{2} b \,{\mathrm e}^{6 i x}-30 a \,b^{2} {\mathrm e}^{6 i x}-6 b^{3} {\mathrm e}^{6 i x}+48 a^{3} {\mathrm e}^{4 i x}+164 a^{2} b \,{\mathrm e}^{4 i x}+26 a \,b^{2} {\mathrm e}^{4 i x}+16 a^{3} {\mathrm e}^{2 i x}+60 a^{2} b \,{\mathrm e}^{2 i x}-10 a \,b^{2} {\mathrm e}^{2 i x}+6 b^{3} {\mathrm e}^{2 i x}-4 a^{2} b -16 a \,b^{2}+3 b^{3}\right )}{3 \left ({\mathrm e}^{2 i x}+1\right )^{3} \left (a +b \right )^{3} a \left (-b \,{\mathrm e}^{4 i x}+4 a \,{\mathrm e}^{2 i x}+2 b \,{\mathrm e}^{2 i x}-b \right )}-\frac {3 b^{2} \ln \left ({\mathrm e}^{2 i x}-\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right )^{3}}-\frac {b^{3} \ln \left ({\mathrm e}^{2 i x}-\frac {2 i a^{2}+2 i a b +2 a \sqrt {-a^{2}-a b}+b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right )^{3} a}+\frac {3 b^{2} \ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b -2 a \sqrt {-a^{2}-a b}-b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{2 \sqrt {-a^{2}-a b}\, \left (a +b \right )^{3}}+\frac {b^{3} \ln \left ({\mathrm e}^{2 i x}+\frac {2 i a^{2}+2 i a b -2 a \sqrt {-a^{2}-a b}-b \sqrt {-a^{2}-a b}}{b \sqrt {-a^{2}-a b}}\right )}{4 \sqrt {-a^{2}-a b}\, \left (a +b \right )^{3} a}\) \(551\)

input
int(sec(x)^4/(a+b*sin(x)^2)^2,x,method=_RETURNVERBOSE)
 
output
1/(a^2+2*a*b+b^2)/(a+b)*(1/3*a*tan(x)^3+1/3*b*tan(x)^3+tan(x)*a+3*tan(x)*b 
)+b^2/(a+b)^3*(1/2/a*b*tan(x)/(a*tan(x)^2+tan(x)^2*b+a)+1/2*(6*a+b)/a/(a*( 
a+b))^(1/2)*arctan((a+b)*tan(x)/(a*(a+b))^(1/2)))
 
3.4.23.5 Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 284 vs. \(2 (82) = 164\).

Time = 0.34 (sec) , antiderivative size = 653, normalized size of antiderivative = 6.80 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\left [-\frac {3 \, {\left ({\left (6 \, a b^{3} + b^{4}\right )} \cos \left (x\right )^{5} - {\left (6 \, a^{2} b^{2} + 7 \, a b^{3} + b^{4}\right )} \cos \left (x\right )^{3}\right )} \sqrt {-a^{2} - a b} \log \left (\frac {{\left (8 \, a^{2} + 8 \, a b + b^{2}\right )} \cos \left (x\right )^{4} - 2 \, {\left (4 \, a^{2} + 5 \, a b + b^{2}\right )} \cos \left (x\right )^{2} + 4 \, {\left ({\left (2 \, a + b\right )} \cos \left (x\right )^{3} - {\left (a + b\right )} \cos \left (x\right )\right )} \sqrt {-a^{2} - a b} \sin \left (x\right ) + a^{2} + 2 \, a b + b^{2}}{b^{2} \cos \left (x\right )^{4} - 2 \, {\left (a b + b^{2}\right )} \cos \left (x\right )^{2} + a^{2} + 2 \, a b + b^{2}}\right ) + 4 \, {\left (2 \, a^{5} + 6 \, a^{4} b + 6 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - {\left (4 \, a^{4} b + 20 \, a^{3} b^{2} + 13 \, a^{2} b^{3} - 3 \, a b^{4}\right )} \cos \left (x\right )^{4} + 2 \, {\left (2 \, a^{5} + 11 \, a^{4} b + 16 \, a^{3} b^{2} + 7 \, a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{24 \, {\left ({\left (a^{6} b + 4 \, a^{5} b^{2} + 6 \, a^{4} b^{3} + 4 \, a^{3} b^{4} + a^{2} b^{5}\right )} \cos \left (x\right )^{5} - {\left (a^{7} + 5 \, a^{6} b + 10 \, a^{5} b^{2} + 10 \, a^{4} b^{3} + 5 \, a^{3} b^{4} + a^{2} b^{5}\right )} \cos \left (x\right )^{3}\right )}}, -\frac {3 \, {\left ({\left (6 \, a b^{3} + b^{4}\right )} \cos \left (x\right )^{5} - {\left (6 \, a^{2} b^{2} + 7 \, a b^{3} + b^{4}\right )} \cos \left (x\right )^{3}\right )} \sqrt {a^{2} + a b} \arctan \left (\frac {{\left (2 \, a + b\right )} \cos \left (x\right )^{2} - a - b}{2 \, \sqrt {a^{2} + a b} \cos \left (x\right ) \sin \left (x\right )}\right ) + 2 \, {\left (2 \, a^{5} + 6 \, a^{4} b + 6 \, a^{3} b^{2} + 2 \, a^{2} b^{3} - {\left (4 \, a^{4} b + 20 \, a^{3} b^{2} + 13 \, a^{2} b^{3} - 3 \, a b^{4}\right )} \cos \left (x\right )^{4} + 2 \, {\left (2 \, a^{5} + 11 \, a^{4} b + 16 \, a^{3} b^{2} + 7 \, a^{2} b^{3}\right )} \cos \left (x\right )^{2}\right )} \sin \left (x\right )}{12 \, {\left ({\left (a^{6} b + 4 \, a^{5} b^{2} + 6 \, a^{4} b^{3} + 4 \, a^{3} b^{4} + a^{2} b^{5}\right )} \cos \left (x\right )^{5} - {\left (a^{7} + 5 \, a^{6} b + 10 \, a^{5} b^{2} + 10 \, a^{4} b^{3} + 5 \, a^{3} b^{4} + a^{2} b^{5}\right )} \cos \left (x\right )^{3}\right )}}\right ] \]

input
integrate(sec(x)^4/(a+b*sin(x)^2)^2,x, algorithm="fricas")
 
output
[-1/24*(3*((6*a*b^3 + b^4)*cos(x)^5 - (6*a^2*b^2 + 7*a*b^3 + b^4)*cos(x)^3 
)*sqrt(-a^2 - a*b)*log(((8*a^2 + 8*a*b + b^2)*cos(x)^4 - 2*(4*a^2 + 5*a*b 
+ b^2)*cos(x)^2 + 4*((2*a + b)*cos(x)^3 - (a + b)*cos(x))*sqrt(-a^2 - a*b) 
*sin(x) + a^2 + 2*a*b + b^2)/(b^2*cos(x)^4 - 2*(a*b + b^2)*cos(x)^2 + a^2 
+ 2*a*b + b^2)) + 4*(2*a^5 + 6*a^4*b + 6*a^3*b^2 + 2*a^2*b^3 - (4*a^4*b + 
20*a^3*b^2 + 13*a^2*b^3 - 3*a*b^4)*cos(x)^4 + 2*(2*a^5 + 11*a^4*b + 16*a^3 
*b^2 + 7*a^2*b^3)*cos(x)^2)*sin(x))/((a^6*b + 4*a^5*b^2 + 6*a^4*b^3 + 4*a^ 
3*b^4 + a^2*b^5)*cos(x)^5 - (a^7 + 5*a^6*b + 10*a^5*b^2 + 10*a^4*b^3 + 5*a 
^3*b^4 + a^2*b^5)*cos(x)^3), -1/12*(3*((6*a*b^3 + b^4)*cos(x)^5 - (6*a^2*b 
^2 + 7*a*b^3 + b^4)*cos(x)^3)*sqrt(a^2 + a*b)*arctan(1/2*((2*a + b)*cos(x) 
^2 - a - b)/(sqrt(a^2 + a*b)*cos(x)*sin(x))) + 2*(2*a^5 + 6*a^4*b + 6*a^3* 
b^2 + 2*a^2*b^3 - (4*a^4*b + 20*a^3*b^2 + 13*a^2*b^3 - 3*a*b^4)*cos(x)^4 + 
 2*(2*a^5 + 11*a^4*b + 16*a^3*b^2 + 7*a^2*b^3)*cos(x)^2)*sin(x))/((a^6*b + 
 4*a^5*b^2 + 6*a^4*b^3 + 4*a^3*b^4 + a^2*b^5)*cos(x)^5 - (a^7 + 5*a^6*b + 
10*a^5*b^2 + 10*a^4*b^3 + 5*a^3*b^4 + a^2*b^5)*cos(x)^3)]
 
3.4.23.6 Sympy [F]

\[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\int \frac {\sec ^{4}{\left (x \right )}}{\left (a + b \sin ^{2}{\left (x \right )}\right )^{2}}\, dx \]

input
integrate(sec(x)**4/(a+b*sin(x)**2)**2,x)
 
output
Integral(sec(x)**4/(a + b*sin(x)**2)**2, x)
 
3.4.23.7 Maxima [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 170 vs. \(2 (82) = 164\).

Time = 0.41 (sec) , antiderivative size = 170, normalized size of antiderivative = 1.77 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\frac {b^{3} \tan \left (x\right )}{2 \, {\left (a^{5} + 3 \, a^{4} b + 3 \, a^{3} b^{2} + a^{2} b^{3} + {\left (a^{5} + 4 \, a^{4} b + 6 \, a^{3} b^{2} + 4 \, a^{2} b^{3} + a b^{4}\right )} \tan \left (x\right )^{2}\right )}} + \frac {{\left (6 \, a b^{2} + b^{3}\right )} \arctan \left (\frac {{\left (a + b\right )} \tan \left (x\right )}{\sqrt {{\left (a + b\right )} a}}\right )}{2 \, {\left (a^{4} + 3 \, a^{3} b + 3 \, a^{2} b^{2} + a b^{3}\right )} \sqrt {{\left (a + b\right )} a}} + \frac {{\left (a + b\right )} \tan \left (x\right )^{3} + 3 \, {\left (a + 3 \, b\right )} \tan \left (x\right )}{3 \, {\left (a^{3} + 3 \, a^{2} b + 3 \, a b^{2} + b^{3}\right )}} \]

input
integrate(sec(x)^4/(a+b*sin(x)^2)^2,x, algorithm="maxima")
 
output
1/2*b^3*tan(x)/(a^5 + 3*a^4*b + 3*a^3*b^2 + a^2*b^3 + (a^5 + 4*a^4*b + 6*a 
^3*b^2 + 4*a^2*b^3 + a*b^4)*tan(x)^2) + 1/2*(6*a*b^2 + b^3)*arctan((a + b) 
*tan(x)/sqrt((a + b)*a))/((a^4 + 3*a^3*b + 3*a^2*b^2 + a*b^3)*sqrt((a + b) 
*a)) + 1/3*((a + b)*tan(x)^3 + 3*(a + 3*b)*tan(x))/(a^3 + 3*a^2*b + 3*a*b^ 
2 + b^3)
 
3.4.23.8 Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 270 vs. \(2 (82) = 164\).

Time = 0.31 (sec) , antiderivative size = 270, normalized size of antiderivative = 2.81 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\frac {b^{3} \tan \left (x\right )}{2 \, {\left (a^{4} + 3 \, a^{3} b + 3 \, a^{2} b^{2} + a b^{3}\right )} {\left (a \tan \left (x\right )^{2} + b \tan \left (x\right )^{2} + a\right )}} + \frac {{\left (6 \, a b^{2} + b^{3}\right )} {\left (\pi \left \lfloor \frac {x}{\pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (2 \, a + 2 \, b\right ) + \arctan \left (\frac {a \tan \left (x\right ) + b \tan \left (x\right )}{\sqrt {a^{2} + a b}}\right )\right )}}{2 \, {\left (a^{4} + 3 \, a^{3} b + 3 \, a^{2} b^{2} + a b^{3}\right )} \sqrt {a^{2} + a b}} + \frac {a^{4} \tan \left (x\right )^{3} + 4 \, a^{3} b \tan \left (x\right )^{3} + 6 \, a^{2} b^{2} \tan \left (x\right )^{3} + 4 \, a b^{3} \tan \left (x\right )^{3} + b^{4} \tan \left (x\right )^{3} + 3 \, a^{4} \tan \left (x\right ) + 18 \, a^{3} b \tan \left (x\right ) + 36 \, a^{2} b^{2} \tan \left (x\right ) + 30 \, a b^{3} \tan \left (x\right ) + 9 \, b^{4} \tan \left (x\right )}{3 \, {\left (a^{6} + 6 \, a^{5} b + 15 \, a^{4} b^{2} + 20 \, a^{3} b^{3} + 15 \, a^{2} b^{4} + 6 \, a b^{5} + b^{6}\right )}} \]

input
integrate(sec(x)^4/(a+b*sin(x)^2)^2,x, algorithm="giac")
 
output
1/2*b^3*tan(x)/((a^4 + 3*a^3*b + 3*a^2*b^2 + a*b^3)*(a*tan(x)^2 + b*tan(x) 
^2 + a)) + 1/2*(6*a*b^2 + b^3)*(pi*floor(x/pi + 1/2)*sgn(2*a + 2*b) + arct 
an((a*tan(x) + b*tan(x))/sqrt(a^2 + a*b)))/((a^4 + 3*a^3*b + 3*a^2*b^2 + a 
*b^3)*sqrt(a^2 + a*b)) + 1/3*(a^4*tan(x)^3 + 4*a^3*b*tan(x)^3 + 6*a^2*b^2* 
tan(x)^3 + 4*a*b^3*tan(x)^3 + b^4*tan(x)^3 + 3*a^4*tan(x) + 18*a^3*b*tan(x 
) + 36*a^2*b^2*tan(x) + 30*a*b^3*tan(x) + 9*b^4*tan(x))/(a^6 + 6*a^5*b + 1 
5*a^4*b^2 + 20*a^3*b^3 + 15*a^2*b^4 + 6*a*b^5 + b^6)
 
3.4.23.9 Mupad [B] (verification not implemented)

Time = 14.09 (sec) , antiderivative size = 176, normalized size of antiderivative = 1.83 \[ \int \frac {\sec ^4(x)}{\left (a+b \sin ^2(x)\right )^2} \, dx=\frac {{\mathrm {tan}\left (x\right )}^3}{3\,{\left (a+b\right )}^2}-\mathrm {tan}\left (x\right )\,\left (\frac {2\,a}{{\left (a+b\right )}^3}-\frac {3}{{\left (a+b\right )}^2}\right )+\frac {b^3\,\mathrm {tan}\left (x\right )}{2\,a\,\left ({\mathrm {tan}\left (x\right )}^2\,\left (a^4+4\,a^3\,b+6\,a^2\,b^2+4\,a\,b^3+b^4\right )+a\,b^3+3\,a^3\,b+a^4+3\,a^2\,b^2\right )}+\frac {b^2\,\mathrm {atan}\left (\frac {b^2\,\mathrm {tan}\left (x\right )\,\left (6\,a+b\right )\,\left (2\,a+2\,b\right )\,\left (a^3+3\,a^2\,b+3\,a\,b^2+b^3\right )}{2\,\sqrt {a}\,{\left (a+b\right )}^{7/2}\,\left (b^3+6\,a\,b^2\right )}\right )\,\left (6\,a+b\right )}{2\,a^{3/2}\,{\left (a+b\right )}^{7/2}} \]

input
int(1/(cos(x)^4*(a + b*sin(x)^2)^2),x)
 
output
tan(x)^3/(3*(a + b)^2) - tan(x)*((2*a)/(a + b)^3 - 3/(a + b)^2) + (b^3*tan 
(x))/(2*a*(tan(x)^2*(4*a*b^3 + 4*a^3*b + a^4 + b^4 + 6*a^2*b^2) + a*b^3 + 
3*a^3*b + a^4 + 3*a^2*b^2)) + (b^2*atan((b^2*tan(x)*(6*a + b)*(2*a + 2*b)* 
(3*a*b^2 + 3*a^2*b + a^3 + b^3))/(2*a^(1/2)*(a + b)^(7/2)*(6*a*b^2 + b^3)) 
)*(6*a + b))/(2*a^(3/2)*(a + b)^(7/2))